<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

use App\Response;
use Illuminate\Support\Facades\Route;

// default
Route::get( '/', function () {
    return Response::json( [ 'code' => 0, 'message' => 'success', 'timestamp' => time() ] );
} );

// todo
Route::middleware( [ 'validate' ] )->group( function () {
    // user
    Route::group( [ 'prefix' => 'user', 'namespace' => '\App\Http\Controllers\User', ], function () {
        Route::get( '', 'Index@index' );    // test
    } );
} );

// 空路由
Route::fallback( function () {
    return Response::json( [ 'code' => 10000, 'message' => 'document not found' ] );
} );